<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.prime.com.tr/ui">


<p:growl id="messages" />

<!--  <p:menubar autoSubmenuDisplay="true" style="position:fixed; margin-top:-47px; width:100%; margin-left:-8px; z-index:102;">   -->
<script>
function setPanelVisible(viewName)
{
	 DesktopRemoteBean.setPanelVisible(viewName,function (){location.reload(true);});

	 console.log('After setPanel visible');
	 	 
}
function onDesktopChange(selectValue)
{
	DesktopRemoteBean.chooseDesktop(selectValue,function (){location.reload(true);});
}

</script>
<p:menubar autoSubmenuDisplay="true" style="z-index:99;">
	<p:submenu label="#{msgs['menu.projects']}" icon="ui-icon ui-icon-document">
		<p:submenu label="New"  icon="ui-icon ui-icon-contact">
		   <p:menuitem value="#{msgs['menu.newTask']}" url="#" helpText="CTRL+N" onclick="setPanelVisible('NewProjectMainView');"/>
		   <p:menuitem value="#{msgs['menu.newProject']}" url="#" helpText="CTRL+N" onclick="setPanelVisible('NewProjectMainView');"/>
		</p:submenu>
		<p:menuitem value="#{msgs['menu.ScheduleMainView']}" url="#" helpText="CTRL+N" onclick="console.log('Before onclic visible');setPanelVisible('ScheduleMainView');"/>
		<p:menuitem value="Projects list" url="#" onclick="setPanelVisible('ProjectsListMainView');" />
		<p:menuitem value="Tasks list" url="#" onclick="setPanelVisible('TasksListMainView');" />
	</p:submenu>

	<p:submenu label="#{msgs['menu.settings']}" icon="ui-icon ui-icon-wrench">
		<p:menuitem value="Undo" url="#" icon="ui-icon ui-icon-arrowreturnthick-1-w" helpText="CTRL+Z"></p:menuitem>
		<p:menuitem value="Redo" url="#" icon="ui-icon ui-icon-arrowreturnthick-1-e" helpText="CTRL+Y"></p:menuitem>
	</p:submenu>

	<p:submenu label="#{msgs['menu.administration']}" icon="ui-icon ui-icon-star">
	<p:menuitem value="#{msgs['menu.usersManagement']}" url="#" helpText="CTRL+N" onclick="setPanelVisible('UsersManagementMainView');"/>
		<p:menuitem value="Contents" url="#" />
		<p:submenu label="Search" icon="ui-icon ui-icon-search">
			<p:submenu label="Text">
				<p:menuitem value="Workspace" url="#" />
			</p:submenu>
			<p:menuitem value="File" url="#" />
		</p:submenu>
	</p:submenu>
	


	<!--   <p:submenu label="Actions" icon="ui-icon ui-icon-gear">  
            <p:submenu label="Ajax" icon="ui-icon ui-icon-refresh">  
                <p:menuitem value="Save" actionListener="#{buttonBean.save}" icon="ui-icon ui-icon-disk" update="messages"/>  
                <p:menuitem value="Update" actionListener="#{buttonBean.update}" icon="ui-icon ui-icon-arrowrefresh-1-w" update="messages"/>  
            </p:submenu>  
            <p:submenu label="Non-Ajax" icon="ui-icon ui-icon-newwin">  
                <p:menuitem value="Delete" actionListener="#{buttonBean.delete}" icon="ui-icon ui-icon-close" update="messages" ajax="false"/>  
            </p:submenu>  
        </p:submenu>   -->

	<p:menuitem value="#{msgs['menu.logout']}" url="#{request.contextPath}/j_spring_security_logout" icon="ui-icon ui-icon-close" />
</p:menubar>
<p:selectOneMenu onchange="onDesktopChange(this.value);" id="desktopSelect" value="#{desktopViewBean.selectedDesktop}" style="position:relative; top: -36px; z-index:99; left:-5px; float: right; ">
             <f:selectItems value="#{desktopViewBean.desktops}" var="desktop" itemLabel="#{desktop}" itemValue="#{desktop}"/>  
 </p:selectOneMenu>  


</html>